/*--------------------------------------------------------------------------
	@class sci.quadrant.QuadrantViewModel
	@author Eduardo Echeverria
	@version 1.0 February 3rd, 2014
	@description
  --------------------------------------------------------------------------
*/

sci.Require('sci.patterns.observer.Observable');
sci.Provide('sci.quadrant.QuadrantViewModel');

//-- Public Constructor -----------------------------------------------------
sci.quadrant.QuadrantViewModel = function (imageName, thumbnail, width, height, thumbnailWidth, thumbnailHeight) {
    sci.patterns.observer.Observable.call(this);

    this.Width = width;
    this.Height = height;
    this.ImageName = imageName;
    this.Thumbnail = thumbnail;
    this.ThumbnailWidth = thumbnailWidth;
    this.ThumbnailHeight = thumbnailHeight;

    this.PosX = 0;
    this.PosY = 0;
};

//-- Public Methods ---------------------------------------------------------
/*--------------------------------------------------------------------------
	@method removeObserver
	@param 
	@description 
  --------------------------------------------------------------------------
*/
sci.quadrant.QuadrantViewModel.prototype.GetX = function () {
    return this.PosX;
};
/*--------------------------------------------------------------------------
	@method removeObserver
	@param 
	@description 
  --------------------------------------------------------------------------
*/
sci.quadrant.QuadrantViewModel.prototype.SetX = function (x) {
    if (this.PosX !== x) {
        this.PosX = x;
        this.UpdateObservers({ Type: 'LocationChange', X: this.PosX, Y: this.PosY });
    }
};
/*--------------------------------------------------------------------------
	@method removeObserver
	@param 
	@description 
  --------------------------------------------------------------------------
*/
sci.quadrant.QuadrantViewModel.prototype.GetY = function () {
    return this.PosY;
};
/*--------------------------------------------------------------------------
	@method removeObserver
	@param 
	@description 
  --------------------------------------------------------------------------
*/
sci.quadrant.QuadrantViewModel.prototype.SetY = function (y) {
    if (this.PosY !== y) {
        this.PosY = y;
        this.UpdateObservers({ Type: 'LocationChange', X: this.PosX, Y: this.PosY });
    }
};
/*--------------------------------------------------------------------------
	@method removeObserver
	@param 
	@description 
  --------------------------------------------------------------------------
*/
sci.quadrant.QuadrantViewModel.prototype.SetLocation = function (x, y) {
    if (this.PosX !== x || this.PosY !== y) {
        this.PosX = x;
        this.PosY = y;
        this.UpdateObservers({ Type: 'LocationChange', X: this.PosX, Y: this.PosY });
    }
};
/*--------------------------------------------------------------------------
	@method removeObserver
	@param 
	@description 
  --------------------------------------------------------------------------
*/
sci.quadrant.QuadrantViewModel.prototype.GetWidth = function () {
    return this.Width;
};
/*--------------------------------------------------------------------------
	@method removeObserver
	@param 
	@description 
  --------------------------------------------------------------------------
*/
sci.quadrant.QuadrantViewModel.prototype.SetWidth = function (w) {
    if (this.Width !== w) {
        this.Width = w;
        this.UpdateObservers({ Type: 'SizeChange', Width: this.Width, Height: this.Height });
    }
};
/*--------------------------------------------------------------------------
	@method removeObserver
	@param 
	@description 
  --------------------------------------------------------------------------
*/
sci.quadrant.QuadrantViewModel.prototype.GetHeight = function () {
    return this.Height;
};
/*--------------------------------------------------------------------------
	@method removeObserver
	@param 
	@description 
  --------------------------------------------------------------------------
*/
sci.quadrant.QuadrantViewModel.prototype.SetHeight = function (h) {
    if (this.Height !== h) {
        this.Height = h;
        this.UpdateObservers({ Type: 'SizeChange', Width: this.Width, Height: this.Height });
    }
};

sci.quadrant.QuadrantViewModel.prototype.GetThumbnailWidth = function () {
    return this.ThumbnailWidth;
};

sci.quadrant.QuadrantViewModel.prototype.GetThumbnailHeight = function () {
    return this.ThumbnailHeight;
};
/*--------------------------------------------------------------------------
	@method removeObserver
	@param 
	@description 
  --------------------------------------------------------------------------
*/
sci.quadrant.QuadrantViewModel.prototype.SetSize = function (w, h) {
    if (this.Width !== w || this.Height !== h) {
        this.Width = w;
        this.Height = h;
        this.UpdateObservers({ Type: 'SizeChange', Width: this.Width, Height: this.Height });
    }
};

sci.quadrant.QuadrantViewModel.prototype.GetImage = function () {
    return this.ImageName;
};

sci.quadrant.QuadrantViewModel.prototype.GetThumbnail = function () {
    return this.Thumbnail;
};

sci.quadrant.QuadrantViewModel.prototype.UpdateContent = function (imageName, thumbnail, width, height, thumbnailWidth, thumbnailHeight) {
    this.Width = width;
    this.Height = height;
    this.ImageName = imageName;
    this.Thumbnail = thumbnail;
    this.ThumbnailWidth = thumbnailWidth;
    this.ThumbnailHeight = thumbnailHeight;

    this.UpdateObservers({ Type: 'ContentUpdate' });
};

sci.InheritsFromClass(sci.quadrant.QuadrantViewModel, 'sci.patterns.observer.Observable');

sci.Ready('sci.quadrant.QuadrantViewModel');